from flask import Blueprint, session

user_blu = Blueprint("user", __name__, url_prefix="/user")


# 判断是否登陆请求钩子
@user_blu.before_request  # 给蓝图设置请求钩子 (只会拦截该蓝图注册的路由)
def check_user():
    user_id = session.get("user_id")
    if not user_id and not request.url.endswith("user_info"):
        return abort(403)


from .views import *
